#ifndef __COMMON_H__
#define __COMMON_H__

#include "comdef.h"
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>

#ifdef WIN32
#include <time.h>
#include <conio.h>
#include <io.h>
#include <direct.h>
#include <stdlib.h>
typedef int socklen_t;
#endif

DLL_EXT_CLASS void my_sleep(unsigned long nSecord);
DLL_EXT_CLASS unsigned long GetTimeStamp(void);
DLL_EXT_CLASS void GetTime(char *pBuf);
DLL_EXT_CLASS void GetTimeEx(char *pBuf);
DLL_EXT_CLASS unsigned long my_GetLastError();
DLL_EXT_CLASS char * GetIpAddressBySock(int nScokId, int &nPort);
DLL_EXT_CLASS int CheckBuf(char *pData, unsigned int nDataLen, int &nCmd, int &nSendId, int &nPacketNum, int &nPacketLen);
DLL_EXT_CLASS int Utf8ToGBK(const char* strUtf8, int nLen, char *outBuf, int &nBuffLen);
DLL_EXT_CLASS int GBKToUtf8(const char* strGBK, int nLen, char *outBuf, int &nBuffLen);
DLL_EXT_CLASS bool CreateDir(const char *pszDirName);
DLL_EXT_CLASS bool DirExist(const char *pszDirName);

#endif
